package com.whmskj.xjlhsc.mobie.empProPlan.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.whmskj.xjlhsc.controller.vo.Result;
import com.whmskj.xjlhsc.mobie.empProPlan.controller.fo.StandConfirmation;
import com.whmskj.xjlhsc.mobie.empProPlan.dto.ScanDeviceSignDto;
import com.whmskj.xjlhsc.mobie.empProPlan.service.ScanScheduleShiftsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @BelongsProject: XJLHSC
 * @BelongsPackage: com.whmskj.xjlhsc.mobie.empProPlan.controller
 * @Author: lk
 * @CreateTime: 2025-07-07
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@SaIgnore
@RequestMapping("/mob/scanScheduleShift")
@Tag(description = "员工扫码签到接口", name = "员工扫码签到接口")
@RequiredArgsConstructor
public class ScanScheduleShiftsController {

    private final ScanScheduleShiftsService scanScheduleShiftsService;


    @GetMapping("/sacnToDeviceList")
    @Operation(description = "员工扫描机台获取签到的机台列表", method = "GET")
    public Result getSacnToDeviceList(@RequestParam(required = false) Integer deviceId) {
        return Result.success(scanScheduleShiftsService.getScanToDeviceList(deviceId));
    }

    @PostMapping("/submitSign")
    /*TODO*/
    @Operation(description = "员工提交签到", method = "POST")
    public Result submitSign(@RequestBody ScanDeviceSignDto scanDeviceSignDto) {
        return Result.success(scanScheduleShiftsService.submitSign(scanDeviceSignDto));
    }

    @GetMapping("/getStandConfirmationList")
    /*TODO*/
    @Operation(description = "组长获取签到确认列表", method = "GET")
    public Result getStandConfirmationList(StandConfirmation fo) {
        return Result.success(scanScheduleShiftsService.getStandConfirmationList(fo));
    }

    @PostMapping("/reject/{id}")
    @Operation(description = "组长拒绝签到", method = "POST")
    public Result reject(@PathVariable Long id) {
        return Result.success(scanScheduleShiftsService.reject(id));
    }


    @PostMapping("/confirm")
    @Operation(description = "组长确认签到", method = "POST")
    public Result confirm(@RequestBody List<Long> confirmIds) {
        return Result.success(scanScheduleShiftsService.confirm(confirmIds));
    }

    @GetMapping("getCheckInHistory")
    @Operation(description = "员工获取签到历史", method = "GET")
    public Result getChackInHistory() {
        return Result.success(scanScheduleShiftsService.getChackInHistory());
    }


}
